<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>tanchu</title>
</head>
<body>
    <div id="app">
        <h2>这是弹出页面</h2>
        <input type="text" id="content">
        <button onclick="sendContent()">向父窗口发送消息</button>
    </div>
</body>
<script>
    function sendContent() {
        const content = document.getElementById('content').value;
        const sendContent = content ? content : 'Hello World';
        console.log(content.value)
        window.opener.postMessage(sendContent)
    }
</script>
</html>
